<%@page import="domain.Contact"%>
<%@page import="java.util.Iterator"%>
<%@page import="domain.ContactGroup"%>
<%@page import="java.util.ArrayList"%>
<%@page import="domain.DAOContact"%>
<%@page import="domain.IDAOContact"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>PROJET MDOC 2012-2013</title>
</head>
<body>

	<h2>Remove contact group</h2>
	
	<p>
	List of existing group :
	
	<table border="1" cellpadding="12">
	<tr>
		<td>id</td>
		<td>name</td>
		<td>members</td>
	</tr>
	<%
	
		IDAOContact dao = new DAOContact();
		ArrayList<ContactGroup>group = dao.getAllExistingContactGroup();
		System.out.println(""+group.size());
		if ( group != null ){
			
			Iterator<ContactGroup>it = group.iterator();
			while ( it.hasNext() ){
				%><tr><%
				ContactGroup cg = it.next();
				out.println("<td>"+cg.getGroupid()+"</td>");
				out.println("<td>"+cg.getGroupName()+"</td>");
				
				
				ArrayList<Contact>contact = dao.getAllExistingContact();
				%><td><%
				if (contact != null){
					Iterator<Contact> cti = contact.iterator();
					while (cti.hasNext()){
						Contact c = cti.next();
						out.print(""+c.getFirstName()+" "+c.getLastName()+" ; ");
					}
				}
				%></td></tr><%
			}
			
			
		}%>
	</table>
	
	<p>
	
	<form method="post" action="DeleteGroupServlet">
	groupname : <input type="text" name="groupname" size="25"><br><br>
	<input type="submit" value="Submit">
	<input type="reset" value="Reset">	
	</form>

	<p><A HREF="Menu.jsp">Back to menu</A></p>


</body>
</html>